<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>宏任务和微任务</title>
</head>
<body>
<script>
  //同：222 4444
  //微：333
  //宏：111
  setTimeout(()=>{ // 宏任务
    console.log(111)
  })
  new Promise((resolve, reject) => {
    resolve()
    console.log(222)// 同步代码
  }).then(value => {
    console.log(333)//微任务
  })
  console.log(444)//同步代码
</script>
</body>
</html>